﻿using Basmus.Values.Attributive;

namespace Basmus.Values
{
    public class QuantityCondition : ICondition
    {
        public QuantityEnum Quantity { get; private set; }

        public QuantityCondition(QuantityEnum quantity)
        {
            Quantity = quantity;
        }

        public bool Check(object[] values)
        {
            if (values != null)
            {
                if (values.Length > 0)
                {
                    return (Quantity & QuantityEnum.HasValues) == QuantityEnum.HasValues;
                }
                return (Quantity & QuantityEnum.Empty) == QuantityEnum.Empty;
            }
            return (Quantity & QuantityEnum.Null) == QuantityEnum.Null;
        }
    }
}